home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxlibs / dwstk102 / findsb.bas < prev    next >
BASIC Source File  |  1995-04-12  |  3KB  |  97 lines

  1. '******************************************************************************
  2. 'File:      findsb.bas
  3. 'Version:   1.02
  4. 'Tab stops: every 2 columns
  5. 'Project:   FINDSB utility
  6. 'Copyright: 1994-1995 DiamondWare, Ltd.  All rights reserved.
  7. 'Written:   Erik Lorenzen & Don Lemons
  8. 'Purpose:   Example code to autodetect and print out the sound hardware
  9. 'History:   94/10/21 KW Started findsb.c
  10. '           94/11/12 DL translated to BASIC
  11. '           95/02/02 EL Cleaned up & Finalized
  12. '           95/03/22 EL Finalized for 1.01
  13. '           95/04/11 EL Finalized for 1.02
  14. '******************************************************************************
  15.  
  16.  
  17.  
  18. '$INCLUDE: 'dws.bi'
  19. '$INCLUDE: 'err.bi'
  20.  
  21.  
  22.  
  23. 'DECLARE VARIABLES
  24.     COMMON SHARED dov     AS dwsDETECTOVERRIDES
  25.     COMMON SHARED dres    AS dwsDETECTRESULTS
  26.     COMMON SHARED ideal AS dwsIDEAL
  27.  
  28.  
  29.  
  30. 'START OF MAIN
  31.  
  32.     PRINT
  33.     PRINT "FINDSB 1.02 is Copyright 1994-95, DiamondWare, Ltd."
  34.     PRINT "All rights reserved."
  35.     PRINT : PRINT : PRINT
  36.  
  37.     'We need to set every field to -1 in dws_DETECTOVERRIDES struct; this
  38.     'tells the STK to autodetect everything.  Any other value
  39.     'overrides the autodetect routine, and will be accepted on
  40.     'faith, though the STK will verify it if possible.
  41.  
  42.     dov.baseport = -1
  43.     dov.digdma     = -1
  44.     dov.digirq     = -1
  45.  
  46.     IF DWSDetectHardWare(dov, dres) = 0 THEN
  47.         errDisplay
  48.     END IF
  49.  
  50.     'Test for FM or DIG
  51.     IF ((dres.capability AND dwscapabilityFM) OR ((dres.baseport <> 904) AND (dres.baseport <> -1))) THEN
  52.  
  53.         PRINT "Base port is ";HEX$(dres.baseport);" hex."
  54.         PRINT
  55.  
  56.         IF dres.mixtyp > 1 THEN
  57.             PRINT "The sound hardware supports mixing."
  58.             PRINT
  59.         ELSE
  60.             PRINT "Mixing will be done in software."
  61.             PRINT
  62.         ENDIF
  63.  
  64.         IF (dres.capability AND dwscapabilityFM) = dwscapabilityFM THEN
  65.             PRINT "The sound hardware supports FM music playback."
  66.             PRINT
  67.         ELSE
  68.             PRINT "Support for FM music playback not found."
  69.             PRINT
  70.         ENDIF
  71.  
  72.         IF (dres.capability AND dwscapabilityDIG) = dwscapabilityDIG THEN
  73.             'If we got here dws_DetectHardWare got PORT, IRQ, & DMA
  74.             PRINT "The sound hardware supports digitized sound playback."
  75.             PRINT "The sound hardware uses DMA channel";dres.digdma;"and IRQ level";dres.digirq;"."
  76.             PRINT
  77.         ELSEIF ((dres.baseport <> 904) AND (dres.baseport <> -1)) THEN
  78.             'If dres.baseport isn't either 388hex, or -1, then it's a valid
  79.             'baseport.  So if we got here, then we didn't find either IRQ
  80.             'level, and/or DMA channel.  In order to play digitized sounds,
  81.             'we need these settings as well.  In your application, you should
  82.             'ask the user.
  83.             PRINT "The sound hardware supports digitized sound playback,"
  84.             PRINT "but we couldn't find the DMA channel and/or IRQ level."
  85.             PRINT
  86.         ELSE
  87.             PRINT "Support for digitized playback not found."
  88.             PRINT
  89.         END IF
  90.  
  91.     ELSE
  92.         PRINT "No sound hardware detected."
  93.         PRINT
  94.     ENDIF
  95.  
  96. END
  97.